import java.sql.*;

public class DatabaseConnection {
    private static final String URL = "jdbc:mysql://192.168.169.76:3306/learnjava?useSSL=false&serverTimezone=UTC";
    private static final String USER = "learn";
    private static final String PASSWORD = "learnpassword";



    public static Connection getConnection() throws SQLException {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            System.out.println("JDBC 驱动加载失败：" + e.getMessage());
        }

        return DriverManager.getConnection(URL, USER, PASSWORD);
    }
}